import React, { Component } from 'react';
import './listIssus.scss'
class issueList extends Component {
  state = {
  }
  // 删除评论
  del = (index) => {
    // console.log(index.target.dataset.index);
    // this.props.del(index.target.dataset.index)
    // this.state.arr.splice(index.target.dataset.index, 1)
    // this.setState({
    //   arr: this.state.arr
    // })
  }
  render () {
    return (
      <>
        <ul className='list'>
          {this.props.arr.map((item, index) => {
            return (
              <li key={index}>
                <h2 className='listTitle'>· 评论人：{item.title}</h2>
                <p className='listContent'>评论内容：{item.content}</p>
                <button className='del' data-index={index} onClick={(e) => this.del(e)}>删除</button>
              </li>
            )
          })}
        </ul>
      </>
    )
  }
}

export default issueList;